<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateVMemberRelationTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('v_member_relation', function (Blueprint $table) {
            $table->increments('id');
            $table->bigInteger('parent_id')->default(0)->comment('父级ID');
            $table->bigInteger('member_id')->default(0)->comment('员工ID');
            $table->string('role_id',32)->default('')->comment('角色ID，21发货人，22收货人，23财务；多个使用,分隔');
            $table->timestamps();
            $table->index('parent_id', 'idx_parent_id');
            $table->index('member_id', 'idx_member_id');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('v_member_relation');
    }
}
